'use strict';

module.exports = app => {
  const { router, controller: { order }, middleware: { validator, checkPageTable, checkParams } } = app;

  const baseUrl = '/api/order';
  router.get(baseUrl + '/my', checkPageTable(), order.indexMy);
  router.get(baseUrl + '/myReview', checkPageTable(), order.indexMyReview);
  router.patch(baseUrl + '/agree', validator('common.checkId'), order.agree);
  router.patch(baseUrl + '/disAgree', validator('common.checkId'), order.disagree);
  router.get(baseUrl + '/statisticalIncome', order.statisticalIncome);
  router.get(baseUrl + '/statisticalIncomeAll', order.statisticalIncomeAll);
  router.get(baseUrl + '/tradingVolume', order.tradingVolume);
  router.get(baseUrl, checkPageTable(), order.index);
  router.get(baseUrl + '/isOrder', order.isOrder);
  router.get(baseUrl + '/:id', checkParams(), order.show);
  router.delete(baseUrl + '/:id', checkParams(), order.destroy);
};
